﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TrackSystem.Entities.Models;

namespace TrackSystem.EntityFramework.Mapping;

public class SlaveMap : IEntityTypeConfiguration<SlaveTable>
{
    public void Configure(EntityTypeBuilder<SlaveTable> builder)
    {
        builder.ToTable("Slave");

        builder.HasKey(s => s.Id);
        builder.HasIndex(s => s.Id).IsUnique();

        builder.Property(s => s.Name).HasMaxLength(50).IsRequired();
        builder.HasIndex(s => s.Name).IsUnique();

        builder.Property(s => s.Description).HasMaxLength(200);
    }
}